package com.biz.primus.auth.controller;

import com.biz.primus.management.base.controller.AbstractBaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class PageController extends AbstractBaseController {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @GetMapping("{path}.do")
    public ModelAndView forwardToPage(@PathVariable String path) {
        logger.debug("Received {} GET request.", path);
        return new ModelAndView(path);
    }

    @GetMapping("{firstPath}/{secondPath}.do")
    public ModelAndView forwardToPage(@PathVariable String firstPath, @PathVariable String secondPath) {
        logger.debug("Received {}/{} GET request.", firstPath, secondPath);
        return new ModelAndView(firstPath + "/" + secondPath);
    }

    @GetMapping("{firstPath}/{secondPath}/{thirdPath}.do")
    public ModelAndView forwardToPage(@PathVariable String firstPath, @PathVariable String secondPath, @PathVariable String thirdPath) {
        logger.debug("Received {}/{}/{} GET request.", firstPath, secondPath, thirdPath);
        return new ModelAndView(firstPath + "/" + secondPath + "/" + thirdPath);
    }

    @GetMapping("welcome")
    public ModelAndView forwardToWelcomePath() {
        return new ModelAndView("welcome");
    }

}
